]> permondes.de Git - Analog_Engine.git/blob - scripts/TP1 03.08 Charge in em field.LACE
Further examples of harmonic oscillation
[Analog_Engine.git] / scripts / TP1 03.08 Charge in em field.LACE
1 #PROGRAM-ID ChargeInEMfield
2 #VERSION 20240116
3 # A mass m with charge q>0 is located in a static electro-magnetic field [0,0,E], [0,-B,0].
4 # Find the trajetory
5 # Differential equation (Lorentz force):
6 # x'' = omega*z'
7 # z'' = a*omega^2 - omega*x'
8 # good start settings are omega=0,92, a*omega^2=0,05
9
10 # coefficient definition
11 alias coefficient.1 -> omega_x # -omega for x'
12 coefficient.2 (+1) -> a*omega^2
13 alias coefficient(3) -> omega_z # omega for z'
14
15 # solving the DE
16 iintegrate (x'') -> -x'
17 iintegrate (-x') -> x
18
19 coefficient.omega_x (-x') -> -omega*x'
20 #cmultiply (-x', omega_x) -> omega*x'
21
22 iintegrate (a*omega^2, -omega*x') -> -z' # input is z''
23 iintegrate (-z') -> z
24 invert (-z') -> z'
25
26 coefficient.omega_z (z') -> omega*z'
27 #cmultiply (z', omega_z) -> omega*z'
28 assign omega*z' -> x''
29
30 output(x) -> out.x
31 output(z) -> out.z